import 'package:dk_flutter_module_sale/phoenix/message/second_message/bean/bean_second__message.dart';
import 'package:flutter/material.dart';

class SecondMessageWidget extends StatelessWidget {
  final MessageList messageListBean;
  final GestureTapCallback tapCallback;
  SecondMessageWidget({this.messageListBean,this.tapCallback});
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: this.tapCallback,
      child: Container(
        margin: EdgeInsets.only(top: 10),
        color: Colors.white,
        child: Row(
          children: <Widget>[
            buildRedDot(),
            Expanded(
                child: Container(
                  padding: EdgeInsets.only(right: 16),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      Row(
                        children: <Widget>[
                          Expanded(
                            child: Padding(
                              padding: EdgeInsets.only(top: 15),
                              child: Text(
                                this.messageListBean.title,
                                style: TextStyle(
                                    color: Color(0xFF333333),
                                    fontSize: 16,
                                    fontWeight: FontWeight.w500
                                ),
                              ),
                            ),
                          ),
                          Padding(
                            child: Text(
                              this.messageListBean.date,
                              style: TextStyle(
                                  color: Color(0xFF333333),
                                  fontSize: 12
                              ),),
                            padding: EdgeInsets.only(top: 21),
                          )
                        ],
                      ),
                      Padding(
                        padding: const EdgeInsets.only(top: 5),
                        child: Text(
                          this.messageListBean.subTitle,
                          style: TextStyle(
                              fontSize: 12,
                              color: Color(0xFF999999)
                          ),
                          overflow: TextOverflow.ellipsis,
                        ),
                      ),
                    ],
                  ),
                )
            )
          ],
        ),
      ),
    );
  }
  Widget buildRedDot() {
    return SizedBox(
      width: 30,
      child: this.messageListBean.hasRead == 1
          ? Text("")
          : Align(
        alignment: Alignment.centerRight,
        child: Container(
          margin: EdgeInsets.only(right: 6 ),
          width: 8,
          height: 8,
          decoration: BoxDecoration(
              color: Color(0xFFFF5D6A),
              borderRadius: BorderRadius.circular(4)
          ),
        ),
      ),
    );
  }
}
